package com.itheima.demo03;

public class MainClass02 {
    public static void main(String[] args) {
        int[] arr = {1,2,3,4,5};
        System.out.println("开始");
        arrPrint(arr);
        System.out.println("结束");
    }

    private static void arrPrint(int[] arr) {
        try{
            System.out.println(arr[5]);
            System.out.println("异常下一行执行了吗？");
        }catch (ArrayIndexOutOfBoundsException e){
            System.out.println("数组越界异常，快点处理！");
            System.out.println(e.getMessage());
            System.out.println(e.toString());
            e.printStackTrace();
        }
    }
}
